﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Index;
using Index.TreeIndex;

namespace IndexTest
{
    class IndexText_Program
    {
        static void Test()
        {
            string text = "abc";
            TextDigits textDigits = new TextDigits(text);
        }

        static void Main(string[] args)
        {
            Test();
            List<ITest> tests = new List<ITest>();

            tests.Add(new TokenMapTest());
            tests.Add(new TreeIndexTierTest());

            foreach (ITest test in tests)
            {
                try
                {
                    if (test.Execute())
                    {
                        Console.WriteLine(test.DisplayName + " SUCCEEDED");
                    }
                    else
                    {
                        Console.WriteLine(test.DisplayName + " FAILED");

                        if (test.FailureDetails != null && test.FailureDetails.Count > 0)
                        {
                            Console.WriteLine("Failure details:\n");

                            foreach (string failureDetail in test.FailureDetails)
                            {
                                Console.WriteLine(failureDetail);
                            }
                        }
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine(test.DisplayName + " threw an exception:");
                    Console.WriteLine(exception.Message + "\n");
                    Console.WriteLine("STACK TRACE:\n" + exception.StackTrace);
                }
            }
        }
    }
}
